package w11;

import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class ValId {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		System.out.println("输入身份证:");
		String no = in.next();
		
		Pattern p = Pattern.compile("^\\d{6}(\\d{4})(\\d{2})(\\d{2})\\d{3}[0-9xX]$");
		Matcher matcher = p.matcher(no);
		if (matcher.matches()) {
			String y = matcher.group(1);
			String m = matcher.group(2);
			String d = matcher.group(3);
			System.out.printf("出生日期：%s-%s-%s", y, m, d);
		} else {
			System.out.println("不合法的身份证");
		}
		
	}

}
